import React, { useState } from 'react'
import List from "./components/List"

// 创建一个可以提供数据的上下文对象
export const App1Context = React.createContext()
export const App2Context = React.createContext()


export default function App() {
  const [count, setCount] = useState()
  return (
    <div>
      <h1>count的值是{count}</h1>
      <button onClick={() => { setCount(count + 1) }}>累加</button>
      <App1Context.Provider value={[1, 2, 3, 4]}>
        <App2Context.Provider value={count}>
          <List />
        </App2Context.Provider>
      </App1Context.Provider>
    </div>
  )
}
